<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<div class="container_0 clearfix">
	<div class="box no-border">
		<div class="header">
			<h2>${pageTitle}</h2>
		</div>
		<isperp:grid url="workflow/bpmnModel/list" gridId="processGrid"
			gridTitle="${pageTitle}" cusFormatterActions="true"
			cusDialogSize="big" cusEditUrl="workflow/bpmnModel/edit"
			ondbClickRowEvent="processGrid.edit(rowid);"
			cusDeleteUrl="workflow/bpmnModel/delete">

			<jsp:attribute name="toolbar">
 				<isperp:toolbar id="processToolbar">
	 				<isperp:button id="processCreate" icon="icon-plus" text="新增"
						onclick="processGrid.create();"></isperp:button> 
					<isperp:button id="processDeploy" icon="icon-edit" text="部署"
						onclick="deployProcess();"></isperp:button> 
					<isperp:button id="processSetting" icon="icon-cogs" text="设置"
						onclick="configProcess();"></isperp:button> 
					<isperp:button id="processExportXml" icon="icon-download"
						text="导出流程xml格式" onclick="exportProcess();"></isperp:button> 
 				</isperp:toolbar>
			</jsp:attribute>

			<jsp:attribute name="searchbar">
					<table class="search-table">
						<tbody>
							<tr>
								<td>名称</td> 
								<td><input type="text" field="description" op="cn">
							</td>
							</tr>
					</tbody>
				</table>
			</jsp:attribute>
			<jsp:body> 
				<isperp:column name="id" title="id" hidden="true"></isperp:column>
				<isperp:column name="key" title="编码" width="100">
				</isperp:column>
				<isperp:column name="name" title="名称" width="150">
				</isperp:column>
				<isperp:column name="version"  align="center" title="版本" width="50">
				</isperp:column>
				<isperp:column name="createTime"  align="center" title="创建时间" width="80">
				</isperp:column>
				<isperp:column name="lastUpdateTime" align="center" title="更新时间" width="80">
				</isperp:column>
			</jsp:body>
		</isperp:grid>
	</div>


</div>

<script type="text/javascript">
	function deployProcess() {
		var id = processGrid.selrow();
		if (id == undefined || id == null) {
			alert("请选择一条记录！");
			return false;
		}

		$.get("workflow/bpmnModel/deploy", {
			modelId : id
		}, function(data) {
			alert(data);
			processGrid.reload();
		});

	}

	function undeployProcess() {
		var id = processGrid.selrow();
		if (id == undefined || id == null) {
			alert("请选择一条记录！");
			return false;
		}
		$.get("workflow/bpmnModel/undeloy", {
			modelId : id
		}, function(data) {
			alert(data);
			processGrid.reload();
		});

	}

	function exportProcess() {
		var id = processGrid.selrow();
		if (id == undefined || id == null) {
			alert("请选择一条记录！");
			return false;
		}

		isperp.showDialog({
			contentUrl : "workflow/bpmnModel/export/" + id
		});

	}

	function configProcess() {
		var id = processGrid.selrow();
		if (id == undefined || id == null) {
			alert("请选择一条记录！");
			return false;
		}

		isperp.openDialog({
			contentUrl : "workflow/bpmnModel/configEdit?id=" + id
		});

	}
</script>